package com.sun.aviatortest;

import com.googlecode.aviator.AviatorEvaluator;
import com.sun.pojo.User;
import com.sun.stringescapeutils.HtmlTest1;

import java.util.HashMap;
import java.util.Map;

public class AviatorTest2 {
    public static void main(String[] args) {
        Map<String,Object> paramMap = new HashMap<>();
        paramMap.put("user",new User("sunXueTeng",25));
        String rule = "user.age >= 25";
        Object execute = AviatorEvaluator.compile(rule).execute(paramMap);
        System.out.println(execute);

        String rule2 = HtmlTest1.toHtml4("string.contains(user.name,&#39;sun&#39;)");

        Object execute1 = AviatorEvaluator.compile(rule2).execute(paramMap);
        System.out.println(execute1);
    }
}
